package com.xl98.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.xl98.entity.Treehole;
import com.xl98.mapper.TreeholeMapper;
import com.xl98.service.TreeholeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ls
 * @since 2020-05-15
 */
@Service
public class TreeholeServiceImpl extends ServiceImpl<TreeholeMapper, Treehole> implements TreeholeService {
    @Autowired
    private TreeholeMapper treeholeMapper;

    @Override
    public List<Treehole> findTreehole(Map<String, String> map) {
        return treeholeMapper.findTreehole(map);
    }

    @Override
    public int insertArticleIdByupdate(Map<String, String> map) {
        return treeholeMapper.insertArticleIdByupdate(map);
    }

    @Override
    public int addTreehole(Treehole treehole) {
        return treeholeMapper.insert(treehole);
    }

    @Override
    public int updateTreehole(Treehole treehole, UpdateWrapper<Treehole> wrapper){
         return treeholeMapper.update(treehole,wrapper);
    }

    @Override
    public boolean delete(String id) {
        if(treeholeMapper.deleteById(id)>0){
            return true;
        }
        return false;
    }

}
